<?php

/** @var \Laravel\Lumen\Routing\Router $router */

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

use Illuminate\Support\Facades\Http;

$router->get('/', function () use ($router) {
    return $router->app->version();
});
$router->get('/api', function () use ($router) {
    return $router->app->version();
});

$router->group(['namespace' => 'Api'],function () use ($router){
    $router->post('/api/get_task_data', 'HomeController@get_task_data');
});

//Vben-admin后台接口
$router->group(['namespace' => 'Admin', 'prefix' => 'admin-api'],function () use ($router){

    $router->post('/register', 'HomeController@register');
    $router->post('/login', 'HomeController@login');

    //需要登录
    $router->group(['middleware' => 'user'], function () use ($router) {

        //用户
        $router->get('getUserInfo', 'UserController@getUserInfo');
        $router->get('getPermCode', 'UserController@getPermCode');
        $router->get('getMenuList', 'UserController@getMenuList');
        $router->get('logout', 'UserController@logout');
        $router->get('system/getAccountList', 'UserController@getAccountList');
        $router->get('system/getAllRoleList', 'UserController@getAllRoleList');
        $router->post('system/accountExist', 'UserController@accountExist');
        $router->post('system/createOrUpdateAccount', 'UserController@createOrUpdateAccount');
        $router->post('system/setAdminStatus', 'UserController@setAdminStatus');

        //角色
        $router->get('system/getRoleListByPage', 'RoleController@getRoleList');
        $router->post('system/setRoleStatus', 'RoleController@setRoleStatus');
        $router->post('system/createOrUpdateRole', 'RoleController@createOrUpdateRole');
        $router->delete('system/deleteRole', 'RoleController@deleteRole');

        //菜单
        $router->get('system/getMenuList', 'PermissionController@getAllMenu');
        $router->post('system/createOrUpdateMenu', 'PermissionController@createOrUpdateMenu');
        $router->delete('system/deleteMenu', 'PermissionController@deleteMenu');

        //amazon分类
        $router->post('category/getCategoryInfo', 'CategoryController@getCategoryInfo');
        $router->post('category/getChildrenInfo', 'CategoryController@getChildrenInfo');
        $router->post('category/getCategoryProduct', 'CategoryController@getCategoryProduct');

        //amazon产品
        $router->post('product/getAsinInfo', 'ProductController@getAsinInfo');
        $router->post('product/getProductInfo', 'ProductController@getProductInfo');
        $router->post('product/getProductByAsin', 'ProductController@getProductByAsin');
        $router->post('product/getProductDetail', 'ProductController@getProductDetail');
        $router->post('product/deleteProduct', 'ProductController@deleteProduct');
        $router->post('product/markProduct', 'ProductController@markProduct');
        $router->post('product/exportXls', 'ProductController@exportXls');

        //任务中心
        $router->post('task/getTaskInfo', 'TaskController@getTaskInfo');
        $router->post('task/taskProduct', 'TaskController@taskProduct');
        $router->get('task/taskSelect', 'TaskController@taskSelect');
    });
});

